import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Solitudefire
 * Date: 2022-08-18
 * Time: 15:10
 */
class OuterClass2 {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    //静态内部类
    static class InnerClass {
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;

        //public OuterClass outerClass = new OuterClass();

        public OuterClass2 out;

        public InnerClass(OuterClass2 out) {
            this.out = out;
        }

        public InnerClass() {

        }

        public void test() {
            System.out.println(out.data1);
            System.out.println(out.data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("InnerClass::test()");
        }
    }
}

class Test {
    public void test() {
        System.out.println("test()haha!");
    }
}

public class TestDemo2 {

    /**
     * 健宝写的
     * @param s
     * @return
     */
    public static int firstUniqChar(String s) {
        int[] array = new int[26];
        for (int i = 0; i < s.length(); i++) {
            array[(int) s.charAt(i) - 97]++;
        }
        for (int i = 0; i < s.length(); i++) {
            if (array[(int) s.charAt(i) - 97] == 1){
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        String s = "leetcode";
        System.out.println(firstUniqChar(s));
    }

    public static void main3(String[] args) {
        new Test() {
            @Override
            public void test() {
                System.out.println("我是重写的test方法！");
            }
        }.test();

        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return 0;
            }
        });
    }

    public static void main2(String[] args) {
        OuterClass2.InnerClass innerClass = new OuterClass2.InnerClass();
    }

    public static void main1(String[] args) {
        OuterClass2 o = new OuterClass2();
        OuterClass2.InnerClass innerClass = new OuterClass2.InnerClass(o);
        innerClass.test();
    }
}
